proc userdel {nick handle chan otbn1 otbn host} {
global botnick home bcast
if {![matchattr $handle o|m $chan]} {
  putserv "NOTICE $nick :Unable To Execute Command - Permission Denied."
  return 0
  }
if {$otbn1 == ""} {
  putserv "NOTICE $nick : ERROR - Invalid Syntax - Should Be - (/msg) $botnick userdel <#channel> <nick>"
  return 0
  }
if {[validuser $otbn1]} {
  set hand2 $otbn1
  } elseif {[onchan $otbn1 $chan]} {
  set hand2 [nick2hand $otbn1 $chan]
  } else {
  putserv "NOTICE $nick : ERROR - $otbn1 not found in user partition."
  return 0
  }
if {$hand2 == $handle} {
  putserv "NOTICE $nick : ERROR - Unable to userdel commanding user - get a user with higher access to do so."
  return 0
  }
if {$otbn == "global"} {
if {![matchattr $handle m]} {
  putserv "NOTICE $nick :Unable To Execute Command - Permission Denied"  	  
  return 0
  }
if {[checkaccess $handle $chan $hand2]} {
  deluser $hand2
  putlog "!$nick ($host)! userdel $hand2 global"
  putserv "NOTICE $nick : Sucessfully userdel'd the user account '\002$otbn1\002' (No exemptions (completely removed user))" 
if {$bcast == "1"} {
  putserv "PRIVMSG $home :\002$nick\002 ($host) requested me to userdel \002$hand2\002 (No Exemptions.)"
  }
  return 0
  } else {
  putserv "NOTICE $nick :Unable To Execute Command - Not Enough Permissions - Permission Denied."
  putserv "NOTICE $otbn1 :\002$nick\002 ($host) tried to userdel you with the 'No Exemptions' option."	    
if {$bcast == "1"} {
  putserv "PRIVMSG $home :\002$nick\002 ($host) tried to userdel \002$hand2\002 with the No Exemptions option - permission was denied."
  }
  return 0
  }
  }
if {![checkaccess $handle $chan $hand2]} {
  putserv "NOTICE $nick :Unable To Execute Command - Not Enough Permissions - Permission Denied."
  putserv "NOTICE $otbn1 :\002$nick\002 ($host) tried to userdel you in $chan"
if {$bcast == "1"} {
  putserv "PRIVMSG $home :\002$nick\002 ($host) tried to userdel \002$otbn1\002 on $chan and $nick is a lower user."
  }
  return 0
  }
if {![delchanrec $hand2 $chan]} {
  putserv "NOTICE $nick : ERROR - User Not Found - $otbn1 not found in channel record '$chan'"
  return 0 
  }
  foreach channel [channels] {
  if {[matchattr $hand2 |f $channel]} {
  putlog "!nick ($host)! userdel $chan $hand2"
  putserv "NOTICE $nick : Sucessfully userdel'd $otbn1 on $chan"
if {$bcast == "1"} {
  putserv "PRIVMSG $home :\002$nick\002 ($host) requested me to userdel \002$hand2\002 in channel record '$chan'"
  }
  return 0
  }
  }
if {[matchattr $hand2 f]} {
  putlog "!$nick ($host)! userdel $chan $hand2" 
  putserv "NOTICE $nick : Sucessfully userdel'd $otbn1 on $chan"	
if {$bcast == "1"} {
  putserv "PRIVMSG $home :\002$nick\002 ($host) requested me to userdel \002$hand2\002 in channel record '$chan'"
  }
  return 0
  }
  deluser $hand2
  putlog "!$nick ($host)! userdel $chan $hand2"
  putserv "NOTICE $nick : Sucessfully userdel'd $otbn1 on $chan"    
if {$bcast == "1"} {
  putserv "PRIVMSG $home :\002$nick\002 ($host) requested me to userdel \002$hand2\002 in channel record '$chan'"
  }  
  }


